package com.viewpagertext.adapters;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.viewpagertext.fragments.LocalAlbumFragment;
import com.viewpagertext.fragments.LocalFoldFragment;
import com.viewpagertext.fragments.LocalGroupFragment;
import com.viewpagertext.fragments.LocalSingerFragment;
import com.viewpagertext.fragments.LocalSingleFragment;

public class LocalMusicAdapter extends FragmentPagerAdapter {

    public LocalMusicAdapter(FragmentManager fm) {
        super(fm);
    }

    @Override
    public Fragment getItem(int i) {
        switch (i) {
            case 0:
                return new LocalSingleFragment();
            case 1:
                return new LocalGroupFragment("album");
            case 2:
                return new LocalGroupFragment("singer");
            case 3:
                return new LocalGroupFragment("fold");
            default:
                return null;
        }
    }

    @Override
    public int getCount() {
        return 4;
    }

    @Override
    public CharSequence getPageTitle(int i) {
        switch (i) {
            case 0:
                return "单曲";
            case 1:
                return "专辑";
            case 2:
                return "歌手";
            case 3:
                return "文件夹";
            default:
                return null;
        }
    }
}
